<?php
/**
 *	css.php - CSS Server
 *	This is Smit Matterhorn - Build 24109
 *	
 *
 * @author		The SmitBoard Team & Community
 * @license		GNU GPL v3
 * @link		http://smitboard.sf.net
 * @since		Matterhorn
 */
 
define('RUN_GENERIC', 'run');

require_once '../../../init.php';

require_once '../../InstallUtils' . EXT;

$utils = InstallUtils::getInstance();

header('Content-Type: text/css');

$stdin = str_replace(array('/', '.'), '', $Smit->lib->input_get('in'));

$location = './' . $stdin . '.css';

// No File to parse? Let's just send blank output.
if(!file_exists($location))
{
	exit('/* FILE MISSING! */');
}

// Let's fetch the file contents
$rawcss = file_get_contents($location);

$tags = array(
	'{smit.mediaurl}' => $utils->base->vars['root']['root_url'] . 'templates/media/',
	'{smit.rooturl}' => $utils->base->vars['root']['root_url'],
);
echo str_replace(array_keys($tags), array_values($tags), $rawcss);
?>